home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_objc.idb / usr / freeware / include / objpak / ocstring.h.z / ocstring.h
Encoding:
C/C++ Source or Header  |  1999-07-16  |  2.7 KB  |  111 lines

  1.  
  2. /*
  3.  * Portable Object Compiler (c) 1997,98,99.  All Rights Reserved.
  4.  * $Id: ocstring.h,v 1.11 1999/06/23 19:22:13 stes Exp $
  5.  */
  6.  
  7. /*
  8.  * This library is free software; you can redistribute it and/or modify it
  9.  * under the terms of the GNU Library General Public License as published 
  10.  * by the Free Software Foundation; either version 2 of the License, or
  11.  * (at your option) any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  * GNU Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public License
  19.  * along with this program; if not, write to the Free Software
  20.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23. #ifndef __OBJSTR_H__
  24. #define __OBJSTR_H__
  25.  
  26. #include "array.h"
  27.  
  28. #ifdef _XtIntrinsic_h
  29. #define String OCString  /* remap String class - cant use Xt String */
  30. #endif
  31.  
  32. typedef struct objstr {
  33.     int        count;
  34.     int        capacity;
  35.     char*    ptr;
  36. } *objstr_t;
  37.  
  38. @interface String : Array
  39. {
  40.     struct objstr    value;
  41. }
  42.  
  43. + new;
  44. + new:(unsigned)nChars;
  45. + str:(STR)aString;
  46. + chars:(STR)aString count:(int)n;
  47. + sprintf:(STR)format,...;
  48. - copy;
  49. - deepCopy;
  50. - free;
  51.  
  52. - (int) compare:aStr;
  53. - (int) compareSTR:(STR)aString;
  54. - (unsigned) hash;
  55. - (int) dictCompare:aStr;
  56. - (BOOL) isEqual:aStr;
  57. - (BOOL) isEqualSTR:(STR)aString;
  58.  
  59. - (unsigned) size;
  60. - (char) charAt:(unsigned)anOffset;
  61. - (char) charAt:(unsigned)anOffset put:(char)aChar;
  62.  
  63. - (STR) strcat:(STR)aBuffer;
  64. - concat:aString;
  65. - concatSTR:(STR)aString;
  66. - concatenateSTR:(STR)aString;
  67. - at:(unsigned)anOffset insert:(char*)aString count:(int)n;
  68. - at:(unsigned)anOffset insert:aString;
  69. - deleteFrom:(unsigned)p to:(unsigned)q;
  70. - assignSTR:(STR)aString;
  71. - assignSTR:(STR)aString length:(unsigned)nChars;
  72.  
  73. - (double) asDouble;
  74. - (int) asInt;
  75. - (long) asLong;
  76. - asSTR:(STR)aBuffer maxSize:(int)aSize;
  77. - (STR) str;
  78. - (STR) strCopy;
  79.  
  80. - toLower;
  81. - toUpper;
  82.  
  83. - printOn:(IOD)aFile;
  84.  
  85. #ifdef __PORTABLE_OBJC__
  86. - fileOutOn:aFiler;
  87. - fileInFrom:aFiler;
  88. #endif /* __PORTABLE_OBJC__ */
  89.  
  90. @end
  91.  
  92. /* some defs needed when cross-compiling with a DIFFERENT compiler */
  93. /* placed this here 'cause we will have a different objcrt.h and Object.h */
  94.  
  95. #if !defined(__PORTABLE_OBJC__)
  96. #if !defined(OCLONGLONG)
  97.  
  98. void *OC_Malloc(size_t); /* allocate memory from the system */
  99. void *OC_Realloc(void *,size_t);/* reallocate memory from the system */
  100.  
  101. #endif /* OCLONGLONG */
  102.  
  103. void *OC_MallocAtomic(size_t); /* allocate memory from the system */
  104. void *OC_Free(void *data);/* deallocate OC_Malloc'ed memory and return NULL */
  105.  
  106. #endif /* __PORTABLE_OBJC__ */
  107.  
  108. #endif /* __OBJSTR_H__ */
  109.  
  110.  
  111.